home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / g_quake / lightb.zip / LIGHTB.QC < prev    next >
Text File  |  1996-09-30  |  11KB  |  266 lines

  1. void() LightBombTouch;
  2. void() LightBombExplode;
  3. void() LightBombTimer;
  4. void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusLight;
  5. void() ThrowLightBomb =
  6. {
  7.         local   entity missile, mpuff;
  8.         self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
  9.         sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
  10.         self.punchangle_x = -2;
  11.         missile = spawn ();
  12.         missile.owner = self;
  13.         missile.movetype = MOVETYPE_BOUNCE;
  14.         missile.solid = SOLID_BBOX;
  15.         missile.classname = "grenade";
  16.         makevectors (self.v_angle);
  17.         if (self.v_angle_x)
  18.                 missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
  19.         else
  20.         {
  21.                 missile.velocity = aim(self, 100);
  22.                 missile.velocity = missile.velocity * 60;
  23.                 missile.velocity_z = 200;
  24.         }
  25.         missile.avelocity = '300 300 300';
  26.         missile.angles = vectoangles(missile.velocity);
  27.         missile.touch = LightBombTouch;
  28.         missile.nextthink = time + 1.5;
  29.         missile.think = LightBombExplode;
  30.         setmodel (missile, "progs/nbomb.mdl");
  31.         setsize (missile, '0 0 0', '0 0 0');
  32.         setorigin (missile, self.origin);
  33. };
  34. void() LightBombTouch =
  35. {
  36.         if (other == self.owner)
  37.                 return;
  38.         if (other.takedamage == DAMAGE_AIM)
  39.         {
  40.                 LightBombExplode();
  41.                 return;
  42.         }
  43.         sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
  44.         if (self.velocity == '0 0 0')
  45.                 self.avelocity = '0 0 0';
  46.  
  47. };
  48. void() LightBombExplode =
  49. {
  50.         T_RadiusLight (self, self.owner, 240, world);
  51.         WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  52.         WriteByte (MSG_BROADCAST, TE_EXPLOSION);
  53.         WriteCoord (MSG_BROADCAST, self.origin_x);
  54.         WriteCoord (MSG_BROADCAST, self.origin_y);
  55.         WriteCoord (MSG_BROADCAST, self.origin_z);
  56.         BecomeExplosion ();
  57. };
  58. void() LightBombTimer =
  59. {
  60.         if (self.health <= 0)
  61.         {
  62.                 remove(self);
  63.                 return;
  64.         }
  65.         else
  66.         {
  67.         stuffcmd(self.owner, "gamma 0.01\n");
  68.         stuffcmd(self.owner, "wait\n");
  69.         stuffcmd(self.owner, "wait\n");
  70.         stuffcmd(self.owner, "gamma 0.02\n");
  71.         stuffcmd(self.owner, "wait\n");
  72.         stuffcmd(self.owner, "wait\n");
  73.         stuffcmd(self.owner, "gamma 0.04\n");
  74.         stuffcmd(self.owner, "wait\n");
  75.         stuffcmd(self.owner, "wait\n");
  76.         stuffcmd(self.owner, "gamma 0.06\n");
  77.         stuffcmd(self.owner, "wait\n");
  78.         stuffcmd(self.owner, "wait\n");
  79.         stuffcmd(self.owner, "gamma 0.08\n");
  80.         stuffcmd(self.owner, "wait\n");
  81.         stuffcmd(self.owner, "wait\n");
  82.         stuffcmd(self.owner, "gamma 0.1\n");
  83.         stuffcmd(self.owner, "wait\n");
  84.         stuffcmd(self.owner, "wait\n");
  85.         stuffcmd(self.owner, "gamma 0.12\n");
  86.         stuffcmd(self.owner, "wait\n");
  87.         stuffcmd(self.owner, "wait\n");
  88.         stuffcmd(self.owner, "gamma 0.14\n");
  89.         stuffcmd(self.owner, "wait\n");
  90.         stuffcmd(self.owner, "wait\n");
  91.         stuffcmd(self.owner, "gamma 0.16\n");
  92.         stuffcmd(self.owner, "wait\n");
  93.         stuffcmd(self.owner, "wait\n");
  94.         stuffcmd(self.owner, "gamma 0.18\n");
  95.         stuffcmd(self.owner, "wait\n");
  96.         stuffcmd(self.owner, "wait\n");
  97.         stuffcmd(self.owner, "gamma 0.2\n");
  98.         stuffcmd(self.owner, "wait\n");
  99.         stuffcmd(self.owner, "wait\n");
  100.         stuffcmd(self.owner, "gamma 0.22\n");
  101.         stuffcmd(self.owner, "wait\n");
  102.         stuffcmd(self.owner, "wait\n");
  103.         stuffcmd(self.owner, "gamma 0.24\n");
  104.         stuffcmd(self.owner, "wait\n");
  105.         stuffcmd(self.owner, "wait\n");
  106.         stuffcmd(self.owner, "gamma 0.26\n");
  107.         stuffcmd(self.owner, "wait\n");
  108.         stuffcmd(self.owner, "wait\n");
  109.         stuffcmd(self.owner, "gamma 0.28\n");
  110.         stuffcmd(self.owner, "wait\n");
  111.         stuffcmd(self.owner, "wait\n");
  112.         stuffcmd(self.owner, "gamma 0.3\n");
  113.         stuffcmd(self.owner, "wait\n");
  114.         stuffcmd(self.owner, "wait\n");
  115.         stuffcmd(self.owner, "gamma 0.32\n");
  116.         stuffcmd(self.owner, "wait\n");
  117.         stuffcmd(self.owner, "wait\n");
  118.         stuffcmd(self.owner, "gamma 0.34\n");
  119.         stuffcmd(self.owner, "wait\n");
  120.         stuffcmd(self.owner, "wait\n");
  121.         stuffcmd(self.owner, "gamma 0.36\n");
  122.         stuffcmd(self.owner, "wait\n");
  123.         stuffcmd(self.owner, "wait\n");
  124.         stuffcmd(self.owner, "gamma 0.38\n");
  125.         stuffcmd(self.owner, "wait\n");
  126.         stuffcmd(self.owner, "wait\n");
  127.         stuffcmd(self.owner, "gamma 0.4\n");
  128.         stuffcmd(self.owner, "wait\n");
  129.         stuffcmd(self.owner, "wait\n");
  130.         stuffcmd(self.owner, "gamma 0.42\n");
  131.         stuffcmd(self.owner, "wait\n");
  132.         stuffcmd(self.owner, "wait\n");
  133.         stuffcmd(self.owner, "gamma 0.44\n");
  134.         stuffcmd(self.owner, "wait\n");
  135.         stuffcmd(self.owner, "wait\n");
  136.         stuffcmd(self.owner, "gamma 0.46\n");
  137.         stuffcmd(self.owner, "wait\n");
  138.         stuffcmd(self.owner, "wait\n");
  139.         stuffcmd(self.owner, "gamma 0.48\n");
  140.         stuffcmd(self.owner, "wait\n");
  141.         stuffcmd(self.owner, "wait\n");
  142.         stuffcmd(self.owner, "gamma 0.50\n");
  143.         stuffcmd(self.owner, "wait\n");
  144.         stuffcmd(self.owner, "wait\n");
  145.         stuffcmd(self.owner, "gamma 0.52\n");
  146.         stuffcmd(self.owner, "wait\n");
  147.         stuffcmd(self.owner, "wait\n");
  148.         stuffcmd(self.owner, "gamma 0.54\n");
  149.         stuffcmd(self.owner, "wait\n");
  150.         stuffcmd(self.owner, "wait\n");
  151.         stuffcmd(self.owner, "gamma 0.56\n");
  152.         stuffcmd(self.owner, "wait\n");
  153.         stuffcmd(self.owner, "wait\n");
  154.         stuffcmd(self.owner, "gamma 0.58\n");
  155.         stuffcmd(self.owner, "wait\n");
  156.         stuffcmd(self.owner, "wait\n");
  157.         stuffcmd(self.owner, "gamma 0.60\n");
  158.         stuffcmd(self.owner, "wait\n");
  159.         stuffcmd(self.owner, "wait\n");
  160.         stuffcmd(self.owner, "gamma 0.62\n");
  161.         stuffcmd(self.owner, "wait\n");
  162.         stuffcmd(self.owner, "wait\n");
  163.         stuffcmd(self.owner, "gamma 0.64\n");
  164.         stuffcmd(self.owner, "wait\n");
  165.         stuffcmd(self.owner, "wait\n");
  166.         stuffcmd(self.owner, "gamma 0.66\n");
  167.         stuffcmd(self.owner, "wait\n");
  168.         stuffcmd(self.owner, "wait\n");
  169.         stuffcmd(self.owner, "gamma 0.68\n");
  170.         stuffcmd(self.owner, "wait\n");
  171.         stuffcmd(self.owner, "wait\n");
  172.         stuffcmd(self.owner, "gamma 0.70\n");
  173.         stuffcmd(self.owner, "wait\n");
  174.         stuffcmd(self.owner, "wait\n");
  175.         stuffcmd(self.owner, "gamma 0.72\n");
  176.         stuffcmd(self.owner, "wait\n");
  177.         stuffcmd(self.owner, "wait\n");
  178.         stuffcmd(self.owner, "gamma 0.74\n");
  179.         stuffcmd(self.owner, "wait\n");
  180.         stuffcmd(self.owner, "wait\n");
  181.         stuffcmd(self.owner, "gamma 0.76\n");
  182.         stuffcmd(self.owner, "wait\n");
  183.         stuffcmd(self.owner, "wait\n");
  184.         stuffcmd(self.owner, "gamma 0.78\n");
  185.         stuffcmd(self.owner, "wait\n");
  186.         stuffcmd(self.owner, "wait\n");
  187.         stuffcmd(self.owner, "gamma 0.80\n");
  188.         stuffcmd(self.owner, "wait\n");
  189.         stuffcmd(self.owner, "wait\n");
  190.         stuffcmd(self.owner, "gamma 0.82\n");
  191.         stuffcmd(self.owner, "wait\n");
  192.         stuffcmd(self.owner, "wait\n");
  193.         stuffcmd(self.owner, "gamma 0.84\n");
  194.         stuffcmd(self.owner, "wait\n");
  195.         stuffcmd(self.owner, "wait\n");
  196.         stuffcmd(self.owner, "gamma 0.86\n");
  197.         stuffcmd(self.owner, "wait\n");
  198.         stuffcmd(self.owner, "wait\n");
  199.         stuffcmd(self.owner, "gamma 0.88\n");
  200.         stuffcmd(self.owner, "wait\n");
  201.         stuffcmd(self.owner, "wait\n");
  202.         stuffcmd(self.owner, "gamma 0.90\n");
  203.         stuffcmd(self.owner, "wait\n");
  204.         stuffcmd(self.owner, "wait\n");
  205.         stuffcmd(self.owner, "gamma 0.92\n");
  206.         stuffcmd(self.owner, "wait\n");
  207.         stuffcmd(self.owner, "wait\n");
  208.         stuffcmd(self.owner, "gamma 0.94\n");
  209.         stuffcmd(self.owner, "wait\n");
  210.         stuffcmd(self.owner, "wait\n");
  211.         stuffcmd(self.owner, "gamma 0.96\n");
  212.         stuffcmd(self.owner, "wait\n");
  213.         stuffcmd(self.owner, "wait\n");
  214.         stuffcmd(self.owner, "gamma 0.98\n");
  215.         stuffcmd(self.owner, "wait\n");
  216.         stuffcmd(self.owner, "wait\n");
  217.         stuffcmd(self.owner, "gamma 1\n");
  218.         }
  219. };
  220.  
  221.  
  222. void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusLight =
  223. {
  224.         local   float   points;
  225.         local   entity  head, timer;
  226.         local   vector  org;
  227.         local   string  st;
  228.  
  229.         head = findradius(inflictor.origin, bounce+40);
  230.  
  231.         while (head)
  232.         {
  233.                 if (head != ignore)
  234.                 {
  235.                         if (head.takedamage)
  236.                         {
  237.                                 org = head.origin + (head.mins + head.maxs)*0.5;
  238.                                 points = 0.5*vlen (org - inflictor.origin);
  239.                                 if (points < 0)
  240.                                         points = 0;
  241.                                 points = bounce - points;
  242.                                 if (points > 0)
  243.                                 {
  244.                                         head.velocity = org - inflictor.origin;
  245.                                         head.velocity = head.velocity * (points / 10);
  246.  
  247.                                         if (head.classname != "player")
  248.                                         {
  249.                                                 if(head.flags & FL_ONGROUND)
  250.                                                         head.flags = head.flags - FL_ONGROUND;
  251.                                         }
  252.                                         else
  253.                                         {
  254.                                                 stuffcmd(head,"gamma 0.001\n");
  255.                                                 timer = spawn();
  256.                                                 timer.nextthink = time + 15;
  257.                                                 timer.think = LightBombTimer;
  258.                                                 timer.owner = head;
  259.                                                 timer.health = 100;
  260.                                         }
  261.                                 }
  262.                         }
  263.                 }
  264.                 head = head.chain;
  265.         }
  266. };